package com.usian.article.controller;

import com.usian.article.service.ApArticleService;
import com.usian.model.article.pojos.ApArticle;
import com.usian.model.article.pojos.ApArticleConfig;
import com.usian.model.article.pojos.ApArticleContent;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleController {

    @Autowired
    private ApArticleService service;

    @PostMapping("/save/config")
    ResponseResult saveArticleConfig(@RequestBody ApArticleConfig apArticleConfig) {
        return service.saveArticleConfig(apArticleConfig);
    }


    @PostMapping("/save")
    ApArticle saveArticle(@RequestBody ApArticle apArticle) {
        service.save(apArticle);
        return apArticle;
    }

    @PostMapping("/save/content")
    ResponseResult saveArticleContent(@RequestBody ApArticleContent apArticleContent) {
        return service.saveArticleContent(apArticleContent);
    }
}
